package com.digua.base.socket.response

import com.digua.base.socket.dispatcher.IResponseDispatcher
import com.digua.base.socket.dispatcher.ResponseDelivery
import org.java_websocket.framing.Framedata


class PongResponse : Response<Framedata> {
    private var framedata: Framedata? = null

    override fun getResponseData(): Framedata? {
        return framedata
    }

    override fun setResponseData(responseData: Framedata) {
        framedata = responseData
    }

    override fun onResponse(dispatcher: IResponseDispatcher?, delivery: ResponseDelivery?) {
        dispatcher?.onPong(framedata, delivery)
    }

    override fun release() {
        framedata = null
        ResponseFactory.releasePongResponse(this)
    }

    override fun toString() = "[@PongResponse${hashCode()}->Framedata:${framedata ?: "null"}]"
}